const mongoose = require('mongoose')
const commonConfig = require('../../config/commonConfig')

mongoose.connect(commonConfig.dbUrl)
// 进行数据库连接
const dbConnection = mongoose.connection
dbConnection.on('error', console.error.bind(console, 'connection error:'))
dbConnection.once('open', function () {
	console.log('连接成功')
})

module.exports = {
	mongoose,
	dbConnection
}
